<?php

namespace app\agentapi\validate;

use think\Validate;

class Category extends Validate
{
    /**
     * 验证规则
     * @var array
     */
    protected $rule = [

        //分类名称
        'name' => [
            'require',
        ],
        //category_id
        'category_id' => [
            'require',
        ],

    ];

    protected $message  =   [
        'category_id.require'   => '参数错误',
        'name.require'   => '分类名称不能为空',
    ];

    /**
     * 验证场景
     * @var array
     */
    protected $scene = [
        'add' => ['name'],
        'edit' => ['category_id','name'],
        'del' => ['category_id','name'],
    ];

}
